import { createRouter, createWebHistory } from "vue-router";
import BASIC_LAYOUT from "../layouts/basic.vue";
import OrderIndex from "../views/order/index.vue";
import MyIndex from "../views/my/index.vue";

const NOT_FOUND_ROUTE = {
  path: "/:pathMatch(.*)*",
  name: "notFound",
  redirect: "/",
};

const routes = [
  {
    path: "/",
    name: "Index",
    component: BASIC_LAYOUT,
    redirect: "/order",
  },
  {
    path: "/order",
    name: "OrderCenter",
    component: BASIC_LAYOUT,
    redirect: "/order/index",
    children: [
      {
        path: "index",
        name: "OrderIndex",
        component: OrderIndex,
      },
    ],
  },
  {
    path: "/my",
    name: "MyCenter",
    component: MyIndex,
  },
  NOT_FOUND_ROUTE,
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
